//
//  UIViewController+HUD.m
//  MobileEnergy
//
//  Created by zhiwei.ma on 14-8-15.
//  Copyright (c) 2014年 Payegis Inc. All rights reserved.
//

#import "UIViewController+HUD.h"
#import "UIView+HUD.h"
#import "MBProgressHUD+CT.h"
@implementation UIViewController (HUD)

//#define EWWAITININGGVIEWTAG 201312
- (void)showWaiting:(BOOL)lock
{
    if (lock)
    {
        [UIApplication sharedApplication].keyWindow.userInteractionEnabled = NO;
        [self.view showHUD];
        
    }
    
    
}
- (void)showWaiting:(NSString *)message Lock:(BOOL)lock
{
    if (lock)
    {
        [UIApplication sharedApplication].keyWindow.userInteractionEnabled = NO;
    }
    [self.view showHUD:message];
}
- (void)showSuccess:(NSString *)success
{
    [MBProgressHUD showSuccess:success lock:NO];
}
- (void)showSuccess:(NSString *)success completionBlock:(void(^)())completionBlock
{
    [MBProgressHUD showSuccess:success lock:NO completionBlock:completionBlock];
}

- (void)showError:(NSString *)error
{
    [MBProgressHUD showError:error];
}
- (void)showError:(NSString *)error completionBlock:(void(^)())completionBlock
{
    [MBProgressHUD showError:error completionBlock:completionBlock];
}


- (void)hideWaiting
{
    [self.view hideHUD];
    [UIApplication sharedApplication].keyWindow.userInteractionEnabled = YES;
}

@end
